;(function(window) {
    var ndedu = {};
    /*首页轮播*/
    ndedu.banner = function() {
        var $swiperContainer = $('.swiper-container');

        var mySwiper = $swiperContainer.swiper({
            loop: true,
            autoplay: 5000,
            speed: 600,
            simulateTouch: false,
            pagination: '.pagination',
            paginationClickable: true,
            autoplayDisableOnInteraction: false
        });

        function resizeSwiper() {
            var rate = 1920 / 780;
            var height = parseInt((window.innerWidth > 1200 ? window.innerWidth : 1200) / rate);
            $swiperContainer.css("height", height);
            $swiperContainer.find('.swiper-slide').css('height', height);
        }
        // resizeSwiper();
        // //当窗口尺寸改变时，延时重新初始化轮播高度
        // $(window).resize(function() {
        //     resizeSwiper();
        // });

        //根据轮播图数量，显隐箭头及分页器
        if ($swiperContainer.find('.swiper-slide').length <= 3) {
            $('.pagination').hide();
            mySwiper.stopAutoplay();
        }

        $swiperContainer.hover(function() {
            mySwiper.stopAutoplay();
        }, function() {
            if ($swiperContainer.find('.swiper-slide').length <= 3) {
                $('.pagination').hide();
                mySwiper.stopAutoplay();
            } else {
                mySwiper.startAutoplay();
            }
        });
    },
    window.ndedu = ndedu;
})(window);
$(function() {
    ndedu.banner();
});
